<template>
	<view>
		<view class="">
			<button class="an" @click="tjdz()">添加地址</button>
		</view>
		<view class="big-box" v-for="(item,index) in shdz">
			<view class="box1">
				{{item.address}}
			</view>
			<view class="box2">
				{{item.xxdz}}
				<img src="../../static/wode/修改.png" alt="" @click='xiugai(index)' >
			</view>
			<view class="box1">
				{{item.name}}---{{item.dianhua}}
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				shdz: [],
				dizi: [{
					address: 'XX市-XX区-XX区', //初始值
					xxdz: 'XX街道XX小区',
					name: '饶伟杰',
					dianhua: '1333****191',
				}]
			}
		},
		onLoad() {
			const value = uni.getStorageSync('dizi');
			if (value.length == 0) {
				uni.setStorageSync('dizi', this.dizi);
				console.log(value.length)
			}
		},
		onShow() {
			const value = uni.getStorageSync('dizi');
			if(value.length==0){
				
			}else{
				this.shdz=value
			}
			
			console.log(value)
		},
		methods: {
		tjdz(){
			uni.navigateTo({
				url: '/pages/wode/sh'
			});
		},
		xiugai(index){
			uni.navigateTo({
				url: '/pages/wode/xgsh?'+"id="+index
			});
		}
		}
	}
</script>

<style lang="scss">
	.big-box {
		margin-left: 20px;
		margin-bottom: 10px;
		// width: 100%;
		height: 80px;
		// border: 1px solid red;

		.box1 {
			color: #7f7f7f;
			margin-bottom: 5px;

		}

		.box2 {
			font-weight: 900;
			margin-bottom: 5px;

			img {
				width: 25px;
				float: right;
				margin-right: 20px;
				// height: 100%;
			}
		}
	}
	.an{
		// border-radius: 15px;
		margin-bottom: 15px;
		
	}
</style>
